package com.qzsoft.zhjd.exp.modules.videomonitor.service.impl;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.qzsoft.system.modules.zhjdsysdept.entity.ZhjdSysDeptEntity;
import com.qzsoft.system.modules.zhjdsysdept.service.ZhjdSysDeptService;
import com.qzsoft.zhjd.exp.modules.videomonitor.service.LaboratoryVideoMonitorService;
import com.qzsoft.zhjd.monitoring.modules.videomonitor.dto.VideoMonitorTreeDto;

/**
 * @ClassName LaboratoryVideoMonitorServiceImpl
 * @Description 水稳视频监控业务接口实现
 * @author linhuawei
 * @since 2022-03-23
 */
@Service
public class LaboratoryVideoMonitorServiceImpl implements LaboratoryVideoMonitorService {

    @Autowired
    private ZhjdSysDeptService zhjdSysDeptService;

    @Override
    public List<VideoMonitorTreeDto> tree() {
        // 获取基地列表
        Map<String, Object> params = new HashMap<String, Object>();
        List<ZhjdSysDeptEntity> baseList = zhjdSysDeptService.listForBase(params);
        List<VideoMonitorTreeDto> result = new ArrayList<VideoMonitorTreeDto>();
        if (null != baseList && 0 < baseList.size()) {
            VideoMonitorTreeDto dto;
            for (ZhjdSysDeptEntity entity : baseList) {
                dto = new VideoMonitorTreeDto();
                dto.setId(entity.getCode());
                dto.setLabel(entity.getName());
                dto.setType("base");
                dto.setChildren(new ArrayList<VideoMonitorTreeDto>());
                result.add(dto);
            }
        }

        return result;
    }

}
